import { QXEvent } from "qx-util";
import { IParam, WizardPanelActionType, IWizardPanelAbility, IWizardPanelControllerParams, IWizardPanelStore, WizardPanelController, ICtrlEvent, IWizardPanelController, IWizardPanelModel } from "@/core";
import { useWizardPanelAction, useWizardPanelBasic, useWizardPanelControllerParams, useWizardPanelProps } from "@/hooks/widget/use-wizard-panel";
import { WizardpanelControlVO } from './state-field-guide-wizard-panel-vo';
import { model } from "./state-field-guide-wizard-panel-model";
import WizardPanelService from "@/core/modules/ctrl-service/wizard-panel-service";
// 基于template/src/widgets/{{appEntities}}/{{ctrls@WIZARDPANEL}}-WizardPanel/{{spinalCase ctrl.codeName}}-wizard-panel-hook.ts.hbs生成
/**
 * 获取输入参数
 *
 * @export
 * @return {*}
 */
export function useProps() {
	return {
		...useWizardPanelProps(),
	};
}

/**
 * 获取基础数据
 *
 * @export
 * @param {*} props
 * @return {*}
 */
export function useBasic(props: any) {
	return {
		...useWizardPanelBasic(model, props),
	};
}

/**
 * 获取行为
 *
 * @export
 */
export function useAction(controller: any) {
	return {
		...useWizardPanelAction(controller),
	};
}

/**
 * 获取控制器
 *
 * @export
 * @param {IParam} props
 * @param {QXEvent<ICtrlEvent<WizardPanelActionType, IWizardPanelAbility>>} evt
 * @return {*}
 */
export function useController(
	props: IParam,
	evt: QXEvent<ICtrlEvent<WizardPanelActionType, IWizardPanelAbility>>,
    otherParams: IParam = {},
): IWizardPanelController<IWizardPanelStore, IWizardPanelAbility> {
	const params: IWizardPanelControllerParams<WizardPanelActionType, IWizardPanelAbility> =
		useWizardPanelControllerParams<IWizardPanelStore, IWizardPanelModel>(model, props, evt, otherParams);
    const ctrlService = new WizardPanelService<WizardpanelControlVO>(WizardpanelControlVO, model.entityCodeName);
  	Object.assign(params, { ctrlService });
  	return new WizardPanelController(params);
}